package com.freecloud.javabasics.design.proxy.custom;

import com.freecloud.javabasics.design.proxy.custom.core.FreeInvocationHandler;

import java.lang.reflect.Method;

/**
 * @Author: maomao
 * @Date: 2020-03-01 21:42
 */
public class CustomProxy implements FreeInvocationHandler {
    private Object target;


    public CustomProxy(Object target){
        this.target = target;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("使用JDK帮忙找工作。");
        //调用目标方法
        Object result = method.invoke(target,args);

        System.out.println("JDK筛选工作，准备面试！");
        return result;
    }
}
